# coding: utf-8
import random
def guess_number():
    secret_number = random.randint(1, 100)
    attempts = 0
    while True:
        guess = int(input("猜一个数字："))
        attempts += 1
        if guess < secret_number:
            print("太小了！")
        elif guess > secret_number:
            print("太大了！")
        else:
            print(f"恭喜你猜对了！答案是{secret_number}，你用了{attempts}次猜中。")
            break
guess_number()